package com.zang.singleton;

/**
 * 静态内部类单例模式
 *
 * @author Zhang Qiang
 * @Date 2019/9/20 11:48
 */
public class StaticHolderSingleton {

    private StaticHolderSingleton(){
        System.out.println("create StaticHoleSingleton");
    }

    /**
     * 静态类的变量只会创建一次
     */
    private static class InstanceClass{
        final static StaticHolderSingleton INSTANCE = new StaticHolderSingleton();
    }

    public static StaticHolderSingleton getInstance(){
        return InstanceClass.INSTANCE;
    }


}
